<template>
  <div class="app-container">
  	<div class="container">
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
		<el-tab-pane label="报告管理" name="first">
			<p class="dialogTitle">{{titleName}}</p>
      <div class="header">
        <span class="title">地震趋势会商意见：</span>
        <div class="icon">
          <!-- <svg-icon class-name="error-icon" icon-class="error" /> -->
		  <span><el-link :underline="false" @click="updateYj">{{textarea2}}</el-link></span>
        </div>
      </div>
      <el-row :gutter="10" class="mb8">
	      <el-col :span="1.5">
	        <el-button type="primary" @click="handleGenerate"><svg-icon class-name="assess-icon" icon-class="assess"/><span style="margin-left:10px">报告生成</span></el-button>
	      </el-col>
	      <!--<el-col :span="1.5">
	        <el-button type="primary" @click="handleDownload"><svg-icon class-name="download-icon" icon-class="download"/><span style="margin-left:10px">下载</span></el-button>
	      </el-col>-->
	      <el-col :span="1.5">
	        <el-button type="primary" @click="handleUpload"><svg-icon class-name="upload-icon" icon-class="upload"/><span style="margin-left:10px">上传</span></el-button>
	      </el-col>
	      <el-col :span="1.5">
	        <el-button type="primary" @click="handleSubmit"><svg-icon class-name="submit-icon" icon-class="submit"/><span style="margin-left:10px">提交审核</span></el-button>
	      </el-col>
	      <el-col :span="1.5">
	        <el-button type="primary" @click="handleEnd"><svg-icon class-name="submit-icon" icon-class="submit"/><span style="margin-left:10px">结束活动</span></el-button>
	      </el-col>
	    </el-row>
	
	    <el-table v-loading="loading" :data="dataExportList" stripe  @selection-change="handleSelectionChange">
	      <el-table-column type="selection" width="55" align="center" />
	      <!--<el-table-column label="报告ID" align="center" prop="attachId" />-->
	      <el-table-column label="报告名称" align="center" prop="srName" width="255"/>
	      <el-table-column label="报告类型" align="center" prop="srType" width="200"/>
	      <el-table-column label="生成时间" align="center" prop="srCreateTime">
	      	<template #default="scope">
	          <span>{{ parseTime(scope.row.srCreateTime, '{y}-{m}-{d}') }}</span>
	        </template>
      	</el-table-column>
	      <el-table-column label="审核状态" align="center" prop="srStatus" />
	      <el-table-column label="评审状态" align="center" prop="pingStatus" />
	      <el-table-column label="评审专家" align="center" prop="pingJia" />
	      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
	        <template #default="scope">
	        	
	          <!--<el-button type="text" @click="handleDetil(scope.row)">查看</el-button>-->
	          
	          <el-button type="text" @click="handleDown(scope.row)">下载</el-button>
	          <el-button type="text" @click="handledel(scope.row)">删除</el-button>
	        </template>
	      </el-table-column>
	    </el-table>
			
		</el-tab-pane>
		<el-tab-pane label="地震灾害风险等级量化评估" name="second">
			<p class="dialogTitle">{{titleName}}</p>
      <div class="header">
        <span class="title">地震趋势会商意见：</span>
        <div class="icon">
          <!-- <svg-icon class-name="error-icon" icon-class="error" /> -->
		  <span>{{textarea2}}</span>
        </div>
      </div>
      <el-table v-loading="loading" :data="dataQuantificationList" stripe  @selection-change="handleSelectionChange">
	      <el-table-column label="评估内容" align="center" prop="content" />
	      <!--<el-table-column label="业务人员" align="center" prop="exportName" />-->
	      
	      <el-table-column label="最新结果操作时间" align="center" prop="dateTime" />
	      <el-table-column label="操作人" align="center" prop="udPeople" />
	      <el-table-column label="联系方式" align="center" prop="exportType" />
	      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
	        <template #default="scope">
	          <el-button type="text" @click="handleDetil(scope.row)">查看</el-button>
	          
	        </template>
	      </el-table-column>
	    </el-table>
		</el-tab-pane>
		<el-tab-pane label="辅助分析对策" name="third">
			<p class="dialogTitle">{{titleName}}</p>
      <div class="header">
        <span class="title">地震趋势会商意见：</span>
        <div class="icon">
          <!-- <svg-icon class-name="error-icon" icon-class="error" /> -->
		  <span>{{textarea2}}</span>
        </div>
      </div>
      <el-table v-loading="loading" :data="dataFzdcList" stripe  @selection-change="handleSelectionChange">
	      <el-table-column label="标题" align="center" prop="exportId" />
	      <el-table-column label="类型" align="center" prop="exportName" />
	      <el-table-column label="重点目标" align="center" prop="exportType" />
	      <el-table-column label="业务人员" align="center" prop="exportType" />
	      <el-table-column label="联系方式" align="center" prop="exportType" />
	      <el-table-column label="最新结果操作时间" align="center" prop="createTime" />
	      <el-table-column label="操作人" align="center" prop="status" />
	      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
	        <template #default="scope">
	          <el-button type="text" @click="handleDetil1(scope.row)">查看</el-button>
	          
	        </template>
	      </el-table-column>
	    </el-table>
		</el-tab-pane>
	 </el-tabs>
  
  <el-dialog
    title="地震趋势会商意见"
    v-model="open"
    width="800px"
    top="200px"
    append-to-body
  >
    <el-form
      ref="singleRef"
      
      
      label-width="120px"
    >

      <el-row style="margin: 20px 0;">
        <el-col :span="24">
          <el-input
			  type="textarea"
			  :autosize="{ minRows: 2, maxRows: 4}"
			  placeholder=""
			  v-model="textarea2">
			</el-input>
        </el-col>
      </el-row>
		
      <el-checkbox v-model="checked" v-if="isShow">今日不再提醒</el-checkbox>
        
      
    </el-form>    
    <template #footer>
      <div class="dialog-footer">
	    <el-button type="primary" @click="submitForm">确 定</el-button>
	    <el-button @click="cancel">取 消</el-button>
	  </div>
    </template>
  </el-dialog>

  
  <el-dialog
    title="请选择报告类型"
    v-model="openbglx"
    width="500px"
    top="200px"
    append-to-body
  >
    <el-form
      ref="bglxRef"           
      label-width="120px"
    >     
    
      <el-row style="margin: 20px 0;">
        <el-col :span="24">
        	<el-radio-group v-model="radio" @change="chooseRadio">
			      <el-radio label="地震灾害风险评估报告">地震灾害风险评估报告</el-radio>
			      <el-radio label="辅助对策报告">辅助对策报告</el-radio>
			    </el-radio-group>
        </el-col>
      </el-row>   
    </el-form>    
    <template #footer>
      <div class="dialog-footer">
	    <el-button type="primary" @click="bglxSubmitForm">确 定</el-button>
	    <el-button @click="openbglx = false">取 消</el-button>
	  </div>
    </template>
  </el-dialog>
  
  <el-dialog
    title="报告管理"
    v-model="openFile"
    width="500px"
    top="200px"
    append-to-body
  >
    <el-form
      ref="bgglRef"           
      label-width="120px"
    >     
  	<p class="dialogTitle">{{titleName}}</p>
    
	  <el-row>
	    <el-col>
	      <el-form-item label="报告名称">
	        <file-upload
	          :action="uploadFileUrl"
	          :limit="1"
	          ref="fileUpload"
	          v-model="formFile.fileList"
	          :fileType='["doc", "docx", "ofd", "txt", "pdf"]'
	        />
	      </el-form-item>
	    </el-col>
	  </el-row>
    </el-form>    
    <template #footer>
      <div class="dialog-footer">
	    <el-button type="primary" @click="fileSubmitForm">保 存</el-button>
	    <el-button @click="openFile = false">取 消</el-button>
	  </div>
    </template>
  </el-dialog>
  <el-dialog v-model="openPic" width="900px" :title="title">
      <el-form ref="emUploadRef" :model="queryParams"  label-width="100px" style="margin-top: 30px;">
      	<div v-if="Content=='地震危险性评估'">
	      	<div v-if="sraAssContent!='地震活动趋势分析'">
	          <el-form-item label="图片" prop="sraAssFileId">
	            <image-upload ref="imageUpload" :limit="limit" :disabled="true" v-model="queryParams.attach" />
	          </el-form-item>
	          <el-form-item label="标题" prop="sraAssFileTitel">
	            <el-input v-model="queryParams.sraAssFileTitel" placeholder="请输入标题" />
	          </el-form-item>
	          <el-form-item label="描述" prop="sraAssFileDescribe">
	            <el-input v-model="queryParams.sraAssFileDescribe" type="textarea" maxlength="300" show-word-limit
	              :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	          </el-form-item>
	        </div>
	        <div v-else>
	          <el-form-item label="图片" prop="sraAssFileIds">
	            <image-upload ref="imageUpload" :limit="limit" :disabled="true" v-model="queryParams.attach" />
	          </el-form-item>
	          <el-form-item label="结论" prop="sraConclusion">
	            <el-input v-model="queryParams.sraConclusion" type="textarea" maxlength="300" show-word-limit
	              :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入结论" />
	          </el-form-item>
	          <el-form-item label="补充描述" prop="sraSupDescription">
	            <el-input v-model="queryParams.sraSupDescription" type="textarea" maxlength="300" show-word-limit
	              :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入补充描述" />
	          </el-form-item>
	        </div>
        </div>
        <div v-if="Content=='人口伤亡评估'">
        	<el-form-item label="图片" prop="scFileId">
            <image-upload ref="imageUpload" :limit="limit" :disabled="true" v-model="queryParams.attach" />
          </el-form-item>
	        <el-form-item label="标题" prop="scFileTitle">
	          <el-input v-model="queryParams.scFileTitle" placeholder="请输入标题" />
	        </el-form-item>
	        <el-form-item label="描述" prop="scFileDescribe">
	          <el-input v-model="queryParams.scFileDescribe" type="textarea" maxlength="300" show-word-limit
	            :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	        </el-form-item>
        </div>
        <div v-if="Content=='重点场所风险评估'">
        	<el-form-item label="上传图片" prop="aiPictureId">
	          <image-upload ref="imageUpload" v-model="queryParams.attach" :limit="limit"  :disabled="true"/>
	        </el-form-item>
	        <el-form-item label="标题" prop="aiPictureTitle">
	          <el-input v-model="queryParams.aiPictureTitle" placeholder="请输入标题" />
	        </el-form-item>
	        <el-form-item label="描述" prop="aiPictureDescription">
	          <el-input v-model="queryParams.aiPictureDescription" type="textarea" maxlength="300" show-word-limit
	            :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	        </el-form-item>
	        <!--<image-uploads ref="imagesUpload" v-model="uploadImg1" />-->
        </div>	
        <div v-if="Content=='次生灾害隐患评估'">
        	<template v-if="ssdContent!='地质灾害统计'">
	          <el-form-item label="图片" prop="ssdImageId">
	            <image-upload ref="imageUpload" :limit="limit" v-model="queryParams.attach" :disabled="true" />
	          </el-form-item>
	          <el-form-item label="标题" prop="ssdImageTitle">
	            <el-input v-model="queryParams.ssdImageTitle" placeholder="请输入标题" />
	          </el-form-item>
	          <el-form-item label="描述" prop="ssdDescribe">
	            <el-input v-model="queryParams.ssdDescribe" type="textarea" maxlength="300" show-word-limit
	              :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	          </el-form-item>
	        </template>
	        <template v-else>
	          <el-row>
	            <el-col :span="24">
	              <el-form-item label="按月统计" prop="ssdMouseFileId">
	                <file-upload ref="ssdMouseFileRef" :limit="limit" :fileType="['xlsx']" :types="type1"
	                  :disabled="true" v-model="queryParams.mouseAttachment" />
	                  <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate('地震地质灾害-按月统计模板.xlsx')">下载模板</el-link>
	                <div style="width:100%">
	                  <el-button type="primary" :disabled="disabledMonFile" @click="createExcleMon">生成图表</el-button>
	                </div>
	              </el-form-item>
	              <template v-if="showMon">
	                <table width="100%" height="100" border="1" cellspacing="0" cellpadding="0">
	                  <tr>
	                    <th colspan="2" rowspan="2">数量月份</th>
	                    <th colspan="2">灾害总数</th>
	                    <th colspan="2">滑坡灾害</th>
	                    <th colspan="2">崩塌灾害</th>
	                    <th colspan="2">泥石流灾害</th>
	                    <th colspan="2">地面塌陷灾害</th>
	                    <th colspan="2">地面沉降灾害</th>
	                    <th colspan="2">地裂缝不稳定斜坡灾害</th>
	                    <th colspan="2">其他灾害</th>
	                  </tr>
	                  <tr>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                    <th>数量</th>
	                    <th>百分比</th>
	                  </tr>
	                  <tr v-for="(item,index) in monList" :key="index">
	                    <template v-for="(val,ind) in item" :key="ind">
	                      <td  v-if="ind==0" colspan="2"><span>{{val}}</span></td>
	                      <td  v-if="ind!=0"><span>{{val}}</span></td>
	                    </template>
	                  </tr>
	                </table>
	                <div id="mainMonPic" style="width: 700px; height: 500px;padding-left: 100px;"></div>
	                <p style="text-align: center;font-weight: bold;">月份</p>
	              </template>
	              <el-form-item label="按月统计标题" prop="ssdMonthTitle">
	                <el-input v-model="queryParams.ssdMonthTitle" placeholder="请输入标题" />
	              </el-form-item>
	            </el-col>
	            <el-col :span="24">
	              <el-form-item label="区域统计" prop="ssdAreaFileId">
	                <file-upload ref="ssdAreaFileRef" :limit="limit" :fileType="['xlsx']" :types="type2"
	                  :disabled="true" v-model="queryParams.areaAttachment" />
	                  <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate('地震地质灾害-区域统计模板.xlsx')">下载模板</el-link>
	                <div style="width:100%">
	                  <el-button type="primary" :disabled="disabledAreaFile" @click="createExcleArea">生成图表</el-button>
	                </div>
	              </el-form-item>
	              <template v-if="showArea">
	                <table width="98%" height="100" border="1" style="margin-left:2%" cellspacing="0" cellpadding="0">
	                  <tr>
	                    <th>区县</th>
	                    <th>灾害总数</th>
	                    <th>滑坡灾害</th>
	                    <th>崩塌灾害</th>
	                    <th>泥石流灾害</th>
	                    <th>地面塌陷灾害</th>
	                    <th>地面沉降灾害</th>
	                    <th>地裂缝不稳定斜坡灾害</th>
	                    <th>其他灾害</th>
	                  </tr>
	                  <tr v-for="(item,index) in areaList" :key="index">
	                    <td v-for="(val,ind) in item" :key="ind">
	                      <span>{{val}}</span>
	                    </td>
	                  </tr>
	                </table>
	                <div id="mainAreaPic" style="width: 700px; height: 500px;padding-left: 100px;"></div>
	                <p style="text-align: center;font-weight: bold;">分区</p>
	              </template>
	              <el-form-item label="区域统计标题" prop="ssdAreaTitle">
	                <el-input v-model="queryParams.ssdAreaTitle" placeholder="请输入标题" />
	              </el-form-item>
	            </el-col>
	            <el-col :span="24">
	              <el-form-item label="描述" prop="ssdDescribe">
	                <el-input v-model="queryParams.ssdDescribe" type="textarea" maxlength="300" show-word-limit
	                  :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	              </el-form-item>
	            </el-col>
	          </el-row>
	        </template>
        </div>	
        <div v-if="Content=='需紧急安置人员'">
        	<el-form-item label="上传附件" prop="udFileId">
            <file-upload ref="udFileRef" :limit="limit" :fileType="['xlsx']" v-model="queryParams.attachment" :disabled="true" />
	          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate('需紧急安置人员模板.xlsx')">下载模板</el-link>
	          <!-- <p style="color:#409eff;cursor: pointer;" @click="handleDown('需紧急安置人员模板.xlsx')">模板下载</p> -->
	          <div style="width:100%">
	            <el-button type="primary" :disabled="disabledUdFile" @click="createExcle">生成表格</el-button>
            	<el-table v-loading="loading1" :data="tableList" stripe v-if="showExcle" style="margin:20px 0">
		            <template v-for="(item,index) in tableTitle" :key="index">
		              <el-table-column :label="item.label" align="center" :prop="item.prop" />
		            </template>
		          </el-table>
	          </div>
	        </el-form-item>
	        <el-form-item label="标题" prop="udTitle">
	          <el-input v-model="queryParams.udTitle" placeholder="请输入标题" />
	        </el-form-item>
	        <el-form-item label="描述" prop="udDescription">
	          <el-input v-model="queryParams.udDescription" type="textarea" maxlength="300" show-word-limit
	            :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	        </el-form-item>
        </div>	
        <div v-if="Content=='房屋地震灾害风险评估'">
        	<template v-if="sdaAssSeiIntensity.substring(0,4) =='房屋破坏'">
	            <el-form-item label="地震烈度" prop="intensity">
	                <el-radio-group v-model="queryParams.intensity">
	                    <el-radio label="6度">6度</el-radio>
	                    <el-radio label="7度">7度</el-radio>
	                    <el-radio label="8度">8度</el-radio>
	                    <el-radio label="9度">9度</el-radio>
	                    <el-radio label="10度">10度</el-radio>
	                </el-radio-group>
	            </el-form-item>
	        </template>
	        <el-form-item label="图片" prop="sdaAssFileId">
	            <image-upload ref="imageUpload" :limit="limit" v-model="queryParams.attach" :disabled="true"/>
	        </el-form-item>
	        <el-form-item label="标题" prop="sdaAssFileTitel">
	            <el-input v-model="queryParams.sdaAssFileTitel" placeholder="请输入标题" />
	        </el-form-item>
	        <el-form-item label="描述" prop="sdaAssFileDescribe">
	            <el-input v-model="queryParams.sdaAssFileDescribe" type="textarea" maxlength="300" show-word-limit
	                :autosize="{ minRows: 3, maxRows: 5}" placeholder="请输入描述" />
	        </el-form-item>
        </div>	
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="openPic=false">取消</el-button>
        </div>
      </template>
    </el-dialog>
 </div> 
</div>
</template>

<script setup name="incident1">
import { getEarthquake } from "@/api/assess/earthquake";
import { getEmphasis } from "@/api/assess/emphasis";
import { getHouse } from "@/api/assess/house";
import { getPopulation } from "@/api/assess/population";
import { getSecond } from "@/api/assess/secondary";
import { getUrgency } from "@/api/assess/urgency";
import * as echarts from "echarts";
import { getProvince, getChildArea} from "@/api/system/division";
import { getDict } from "@/api/system/dict";
import imageUploads from './ImageUpload/index.vue'
import {
  getList,
  delList,
  saveList,
  updateList,
  serchList,
  getImport,
  getName,
  getDw,
  getActivityIdList,
  getDataQuantification,
  getDataExport,
  saveReport,
  delReport,
} from "@/api/business/activities";
const { proxy } = getCurrentInstance();
const route = useRoute();
const activeName = ref("first");
const radio = ref("地震灾害风险评估报告");
const open = ref(false);
const openbglx = ref(false);
const openFile = ref(false);
const openPic = ref(false);
const loading = ref(false);
const checked = ref(false);
const isShow = ref(true);
const textarea2 = ref("");
const titleName = ref("");
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const form = ref({});
const queryParams = ref({});
const formFile = ref({});
const title = ref();
const Content = ref('');
const sraAssContent = ref('');
const ssdContent = ref('');
const sdaAssSeiIntensity = ref('');
const scAssContent = ref('');

const disabledMonFile = ref(true);
const disabledAreaFile = ref(true);
const mainAreaPic = ref();
const showMon = ref(false);
const showArea = ref(false);
const monTitle = ref();
const areaTitle = ref();
const monList = ref([]);
const areaList = ref([]);

const disabledUdFile = ref(true);
const showExcle = ref(false); 
const tableList = ref([]);
const tableTitle = ref([]);

const uploadImg1 = ref([]);
  
const uploadFileUrl = ref(
  import.meta.env.VITE_APP_BASE_API + "/attachment/uploadFile"
); // 上传的图片服务器地址

const LineChartMon = ref();
const LineChartArea = ref();

const dataExportList = ref([
	{
		exportId:"1",
		exportName:"【系统生成】建党100周年庆祝活动期间北京市城市地震灾害风险评估初步结论",
		exportType:"地震灾害风险评估报告",
		createTime:"",
		status:""
	},{
		exportId:"2",
		exportName:"建党100周年庆祝活动期间北京市城市地震灾害风险评估初步结论",
		exportType:"地震灾害风险评估报告",
		createTime:"",
		status:"待审核"
	},{
		exportId:"3",
		exportName:"【系统生成】建党100周年庆祝活动期间北京市城市辅助对策分析初步结论",
		exportType:"辅助对策报告",
		createTime:"",
		status:"审核通过"
	},{
		exportId:"4",
		exportName:"建党100周年庆祝活动期间北京市城市辅助对策分析初步结论",
		exportType:"辅助对策报告",
		createTime:"",
		status:"审核未通过"
	}
])

const dataQuantificationList = ref([
	{
		exportId:"地震构造图",
		exportName:"",
		exportType:"",
		createTime:"",
		status:""
	},{
		exportId:"历史地震分布图",
		exportName:"",
		exportType:"",
		createTime:"",
		status:""
	},{
		exportId:"地震活动趋势分析",
		exportName:"",
		exportType:"",
		createTime:"",
		status:""
	},{
		exportId:"地震危险性分析",
		exportName:"",
		exportType:"",
		createTime:"",
		status:""
	}
])


const dataFzdcList = ref([
	{
		exportId:"1",
		exportName:"物资储备点分布图",
		exportType:"故宫",
		createTime:"",
		status:""
	},{
		exportId:"2",
		exportName:"避难场所分布图",
		exportType:"故宫",
		createTime:"",
		status:""
	},{
		exportId:"3",
		exportName:"学校分布图",
		exportType:"故宫",
		createTime:"",
		status:""
	},{
		exportId:"4",
		exportName:"地震应急疏散辅助决策图",
		exportType:"故宫",
		createTime:"",
		status:""
	}
])

function getData() {
  open.value = false;
  getImport(route.query.id).then(response => {
  	form.value = response.data.importantActivity;
    textarea2.value = response.data.importantActivity.iaOpinion;
    titleName.value = response.data.importantActivity.iaName;    
    if(response.data.importantActivity.iaOpinionStatus=="0"){
    	checked.value = false;
    	open.value = true;
    }else{
    	checked.value = true;
    	open.value = false;
    }
       
	});
}

function fileSubmitForm(){
	const fileList = JSON.parse(
    JSON.stringify(proxy.$refs["fileUpload"].fileList)
  );
  // console.log(fileList);
  const attachIds = [];
  for (var i = 0; i < fileList.length; i++) {
    attachIds.push(fileList[i].attachId);
  }
  formFile.value.iabgId = attachIds.join(",");
  		saveReport({
        iaId: route.query.id,
        attachId: formFile.value.iabgId,
        srType: radio.value,
      }).then((res) => {
        openFile.value = false;
        proxy.$modal.msgSuccess("新增成功");
        formFile.value.fileList = undefined;
        getDataExportList();
      });
}

function submitForm() {
	//console.log(form.value)
	var iaOpinionStatus;
	if(checked.value){
		iaOpinionStatus = 1
	}else{
		iaOpinionStatus = 0
	}
	form.value.iaOpinion = textarea2.value;
	form.value.iaOpinionStatus = iaOpinionStatus;
	updateList(form.value).then((res) => {
    open.value = false;
    proxy.$modal.msgSuccess("修改成功");
  });

}

// 取消按钮
function cancel() {
  open.value = false;
}
function handleGenerate(){
	proxy.$modal.msg("功能暂无");
}
function handleDownload(){
	proxy.$modal.msg("功能暂无");
}
function handleUpload(){
	//proxy.$modal.msg("功能暂无");
	openbglx.value = true;
	formFile.value = {};
	
	
}
function handleSubmit(){
	proxy.$modal.msg("功能暂无");
}
function handleEnd(){
	proxy.$modal.msg("功能暂无");
}
function updateYj(){
	open.value = true;
}

function handleDown(row){
	location.href = import.meta.env.VITE_APP_BASE_API + "/attachment/downLoadFile?attachId="+ encodeURIComponent(row.attachId);
}
function handledel(row){
	proxy.$modal.confirm('是否确认删除？').then(function() {
    delReport(row.srId).then((res) => {

	    proxy.$modal.msgSuccess("删除成功");
	    getDataExportList();
	  });
	}).then(() => {
	    
	}).catch(() => {});
	
}



function bglxSubmitForm(){
	formFile.value.fileList = undefined;
	openFile.value = true;
	openbglx.value = false;
	console.log(radio.value)
}
/*查询报告*/
function getDataExportList(){
	getDataExport(route.query.id).then((res) => {
    dataExportList.value = res.data;
    //total.value = res.data.total;
    
  });
}
/*查询评估*/
function getDataQuantificationList(){
	getDataQuantification(route.query.id).then((res) => {
    dataQuantificationList.value = res.data;
    //total.value = res.data.total;
    
  });
}

// 重置上传
function reset() {
  queryParams.value = {
    aiPictureId: undefined,
    attach: [],
    aiPictureTitle: '',
    aiPictureDescription: '',
  }
  proxy.resetForm("emUploadRef");
  uploadImg1.value = [];
}
/** 查看方法*/
function handleDetil(row) {
  title.value = '查看';
  reset();
  if(row.taskName == "地震危险性评估"){
  	Content.value = "地震危险性评估"
  	if(row.content == "地震活动趋势分析"){
  		sraAssContent.value = "地震活动趋势分析"
  	}else{
  		sraAssContent.value = ""
  	}
  	getEarthquake(row.id).then(response => {
	    queryParams.value = response.data.riskAssessmentById;
	    sraAssContent.value = response.data.riskAssessmentById.sraAssContent;
	    queryParams.value.attach = [response.data.attach];
	    title.value = "查看"
	    openPic.value = true;
	  })
  }else if(row.taskName == "人口伤亡评估"){
  	Content.value = "人口伤亡评估"
  	getPopulation(row.id).then(response => {
      queryParams.value = response.data.casualtiesEntity;
      scAssContent.value = response.data.casualtiesEntity.scAssContent;
      queryParams.value.attach = [response.data.attach];
      title.value = "查看"
      openPic.value = true;
    })
  }else if(row.taskName == "重点场所风险评估"){
  	Content.value = "重点场所风险评估"
  	getEmphasis(row.id).then(response => {
	    if(response.data.assInfos.length>1){
	      uploadImg1.value = response.data.assInfos.splice('1')
	      console.log(uploadImg1.value,'ashgauygdua');
	    }
	    queryParams.value = response.data.assInfos[0];
	    queryParams.value.attach = [response.data.assInfos[0].attachmentInfoEntity];
//	    krId.value = response.data.krId;
	    title.value = "查看"
	    openPic.value = true;
	  })
  }else if(row.taskName == "次生灾害隐患评估"){
  	Content.value = "次生灾害隐患评估"
  	if(row.content == "地质灾害统计"){
  		ssdContent.value = "地质灾害统计"
  	}
  	getSecond(row.id).then(response => {
		if(document.getElementById('mainMonPic')){
      		LineChartMon.value.dispose();
    	}
  		if(document.getElementById('mainAreaPic')){
  		  LineChartArea.value.dispose();
  		}
	    queryParams.value = response.data.secondDisastersById;
	    ssdContent.value = response.data.secondDisastersById.ssdContent;
	    queryParams.value.mouseAttachment = [response.data.mouseAttachment];
	    queryParams.value.areaAttachment = [response.data.areaAttachment];
	    queryParams.value.attach = [response.data.imageAttachment];
		title.value = "查看"
	    openPic.value = true;
	    nextTick(()=>{
	      monList.value =response.data.excelByMouth.lists;
	      initMon(response.data.excelByMouth);
	      areaList.value = response.data.excelByArea.lists;
	      initArea(response.data.excelByArea);
	    })
	    disabledMonFile.value = false;
	    disabledAreaFile.value = false;
	    showMon.value = true;
	    showArea.value = true;
	  })
  }else if(row.taskName == "需紧急安置人员"){
  	Content.value = "需紧急安置人员"
  	getUrgency(row.id).then(response => {
      queryParams.value = response.data.urgencysettleData;
      queryParams.value.attachment = [response.data.attach];
      Object.entries(response.data.forms[0]).forEach(item=>{
      tableTitle.value.push({label:item[1],prop:item[0]})
      })
      tableList.value = response.data.forms.splice('1') ;
      disabledUdFile.value = false;
      showExcle.value = true;
      title.value = "查看"
      openPic.value = true;
    })
  }else if(row.taskName == "房屋地震灾害风险评估"){
  	Content.value = "房屋地震灾害风险评估"
  	sdaAssSeiIntensity.value = row.content
  	getHouse(row.id).then(response => {
        queryParams.value = response.data.disasterAssEntity;
        sdaAssSeiIntensity.value = response.data.disasterAssEntity.sdaAssSeiIntensity;
        queryParams.value.intensity = sdaAssSeiIntensity.value.split('-')[1];
        queryParams.value.attach = [response.data.attach];
        title.value = "查看"
        openPic.value = true;
    })
  }
  

}

function initMon(data) {
  // 基于准备好的dom，初始化echarts实例
  console.log(document.getElementById('mainMonPic'), '获取id');
//   document.getElementById("mainMonPic").removeAttribute('_echarts_instance_');
	LineChartMon.value = echarts.init(document.getElementById('mainMonPic'));
  // 指定图表的配置项和数据
  var option = {
    xAxis: {
      type: 'category',
      data: data.mouth,
      axisLabel: {
        interval: 0, // 调整数值即可调整坐标显示间隔
      }
    },
    yAxis: {
      type: 'value',
      name: '数量'
    },
    series: [
      {
        name: '数量',
        data: data.sum,
        type: 'bar',
      },
    ]
  };
  // 使用刚指定的配置项和数据显示图表。 给一个延时
  LineChartMon.value.clear();
  option && LineChartMon.value.setOption(option);
}

function initArea(data) {
  // 基于准备好的dom，初始化echarts实例
//   document.getElementById("mainAreaPic").removeAttribute('_echarts_instance_');
  LineChartArea.value = echarts.init(document.getElementById('mainAreaPic'));
  // 指定图表的配置项和数据
  var option = {
    xAxis: {
      type: 'category',
      data: data.areaList
    },
    yAxis: {
      type: 'value',
      name: '数量/起'
    },
    series: [
      {
        data: data.countList,
        type: 'bar',
      }
    ]
  };
  // 使用刚指定的配置项和数据显示图表。
  LineChartArea.value.clear();
  option && LineChartArea.value.setOption(option); 
}
// 生成按月的图表
function createExcleMon() {
  createMonFile(queryParams.value.ssdMouseFileId).then(res => {
    console.log(res.data);
    showMon.value = true;
    nextTick(() => {
      monList.value = res.data.lists;
      initMon(res.data);
    })
  })
}

// 生成区域的图表
function createExcleArea() {
  createAreaFile(queryParams.value.ssdAreaFileId).then(res => {
    console.log(res.data);
    showArea.value = true;
    nextTick(() => {
      areaList.value = res.data.lists;
      initArea(res.data);
    })
  })
}

// 模板下载
function importTemplate(name) {
  proxy.download("/fxfzaqbz/data/downloadExcel", {
    fileName:name
  }, name);
};

function getDetail(id) {
  getEmphasis(id).then(response => {
    if(response.data.assInfos.length>1){
      uploadImg1.value = response.data.assInfos.splice('1')
      console.log(uploadImg1.value,'ashgauygdua');
    }
    queryParams.value = response.data.assInfos[0];
    queryParams.value.attach = [response.data.assInfos[0].attachmentInfoEntity];
    krId.value = response.data.krId;
    title.value = "查看"
    //open.value = true;
  })
}
/*切换标签页*/
function handleClick(tab, event) {
    console.log(tab, event);
    console.log(tab.props.name);
		if(tab.props.name=="first"){
			//getMapList();
		}else if(tab.props.name=="second"){
			getDataQuantificationList();
		}
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}
function chooseRadio(value){
	console.log(value)
	
}
getDataExportList()
getData()
</script>

<style lang="scss" scoped>
.container {
  margin: 0px auto;
  height: 100%;
  width: 1200px;
  overflow-y: auto;

  .worrning {
    width: 340px;
    height: 110px;
    color: #3d4a5d;
    font-size: 18px;
    line-height: 26px;
    background: #f5f9fe;
    margin: 30px auto 10px;
    padding: 15px;
  }

  .header {
    padding: 10px 0px;

    .title {
      font-size: 18px;
      font-weight: bold;
    }

    div {
      height: 60px;
      line-height: 60px;
      margin-top: 10px;

      &.icon {
        padding: 0 20px;
        background: #f5f9fe;
      }

      span {
        margin-left: 10px;
      }
    }
  }
}
</style>